package org.example.flatmap;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;

public class Java8FlatMap7 {
    public static void main(String[] args) throws IOException {
        Path path = Paths.get("E:\\work_template\\test.txt");
        Stream<String> lines = Files.lines(path);
        /*lines.forEach(System.err::println);*/
        Stream<String> words = lines.flatMap(x -> Stream.of(x.split(" +")));
        /*long wordsCount = words.count();
        System.err.println(wordsCount);*/
        words.forEach(System.err::println);

    }
}
